package com.upb.webserver.dao.mapper;

import com.upb.webserver.dao.entity.TbTransAudit;
import com.upb.webserver.dao.entity.TbTransAuditExample;
import java.util.List;
import java.util.Optional;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface TbTransAuditMapper {

    @Update({ "update tb_trans_audit", "set status = #{status,jdbcType=INTEGER}, modify_time = now()", "where id = #{id,jdbcType=INTEGER}" })
    int modifyStatus(@Param("id") Integer id, @Param("status") Integer status);

    @Select({ "select", "id, chain_id, chain_name, group_id, app_name, keyword, comment, tx_hash, ", "address, chain_type, type, status, create_time, modify_time", "from tb_trans_audit", "where tx_hash = #{txHash,jdbcType=VARCHAR}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "chain_id", property = "chainId", jdbcType = JdbcType.INTEGER), @Result(column = "chain_name", property = "chainName", jdbcType = JdbcType.VARCHAR), @Result(column = "group_id", property = "groupId", jdbcType = JdbcType.INTEGER), @Result(column = "app_name", property = "appName", jdbcType = JdbcType.VARCHAR), @Result(column = "keyword", property = "keyword", jdbcType = JdbcType.VARCHAR), @Result(column = "comment", property = "comment", jdbcType = JdbcType.VARCHAR), @Result(column = "tx_hash", property = "txHash", jdbcType = JdbcType.VARCHAR), @Result(column = "address", property = "address", jdbcType = JdbcType.VARCHAR), @Result(column = "chain_type", property = "chainType", jdbcType = JdbcType.TINYINT), @Result(column = "type", property = "type", jdbcType = JdbcType.TINYINT), @Result(column = "status", property = "status", jdbcType = JdbcType.TINYINT), @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP) })
    TbTransAudit selectByTxHash(String txHash);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbTransAuditSqlProvider.class, method = "countByExample")
    long countByExample(TbTransAuditExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @DeleteProvider(type = TbTransAuditSqlProvider.class, method = "deleteByExample")
    int deleteByExample(TbTransAuditExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @Delete({ "delete from tb_trans_audit", "where id = #{id,jdbcType=INTEGER}" })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @Insert({ "insert into tb_trans_audit (chain_id, chain_name, ", "group_id, app_name, ", "keyword, comment, ", "tx_hash, address, ", "chain_type, type, ", "status, create_time, ", "modify_time)", "values (#{chainId,jdbcType=INTEGER}, #{chainName,jdbcType=VARCHAR}, ", "#{groupId,jdbcType=INTEGER}, #{appName,jdbcType=VARCHAR}, ", "#{keyword,jdbcType=VARCHAR}, #{comment,jdbcType=VARCHAR}, ", "#{txHash,jdbcType=VARCHAR}, #{address,jdbcType=VARCHAR}, ", "#{chainType,jdbcType=TINYINT}, #{type,jdbcType=TINYINT}, ", "#{status,jdbcType=TINYINT}, #{createTime,jdbcType=TIMESTAMP}, ", "#{modifyTime,jdbcType=TIMESTAMP})" })
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insert(TbTransAudit record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @InsertProvider(type = TbTransAuditSqlProvider.class, method = "insertSelective")
    @SelectKey(statement = "SELECT LAST_INSERT_ID()", keyProperty = "id", before = false, resultType = Integer.class)
    int insertSelective(TbTransAudit record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbTransAuditSqlProvider.class, method = "selectByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "chain_id", property = "chainId", jdbcType = JdbcType.INTEGER), @Result(column = "chain_name", property = "chainName", jdbcType = JdbcType.VARCHAR), @Result(column = "group_id", property = "groupId", jdbcType = JdbcType.INTEGER), @Result(column = "app_name", property = "appName", jdbcType = JdbcType.VARCHAR), @Result(column = "keyword", property = "keyword", jdbcType = JdbcType.VARCHAR), @Result(column = "comment", property = "comment", jdbcType = JdbcType.VARCHAR), @Result(column = "tx_hash", property = "txHash", jdbcType = JdbcType.VARCHAR), @Result(column = "address", property = "address", jdbcType = JdbcType.VARCHAR), @Result(column = "chain_type", property = "chainType", jdbcType = JdbcType.TINYINT), @Result(column = "type", property = "type", jdbcType = JdbcType.TINYINT), @Result(column = "status", property = "status", jdbcType = JdbcType.TINYINT), @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP) })
    List<TbTransAudit> selectByExample(TbTransAuditExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @Select({ "select", "id, chain_id, chain_name, group_id, app_name, keyword, comment, tx_hash, address, ", "chain_type, type, status, create_time, modify_time", "from tb_trans_audit", "where id = #{id,jdbcType=INTEGER}" })
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "chain_id", property = "chainId", jdbcType = JdbcType.INTEGER), @Result(column = "chain_name", property = "chainName", jdbcType = JdbcType.VARCHAR), @Result(column = "group_id", property = "groupId", jdbcType = JdbcType.INTEGER), @Result(column = "app_name", property = "appName", jdbcType = JdbcType.VARCHAR), @Result(column = "keyword", property = "keyword", jdbcType = JdbcType.VARCHAR), @Result(column = "comment", property = "comment", jdbcType = JdbcType.VARCHAR), @Result(column = "tx_hash", property = "txHash", jdbcType = JdbcType.VARCHAR), @Result(column = "address", property = "address", jdbcType = JdbcType.VARCHAR), @Result(column = "chain_type", property = "chainType", jdbcType = JdbcType.TINYINT), @Result(column = "type", property = "type", jdbcType = JdbcType.TINYINT), @Result(column = "status", property = "status", jdbcType = JdbcType.TINYINT), @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP) })
    TbTransAudit selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbTransAuditSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") TbTransAudit record, @Param("example") TbTransAuditExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbTransAuditSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") TbTransAudit record, @Param("example") TbTransAuditExample example);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @UpdateProvider(type = TbTransAuditSqlProvider.class, method = "updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(TbTransAudit record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @Update({ "update tb_trans_audit", "set chain_id = #{chainId,jdbcType=INTEGER},", "chain_name = #{chainName,jdbcType=VARCHAR},", "group_id = #{groupId,jdbcType=INTEGER},", "app_name = #{appName,jdbcType=VARCHAR},", "keyword = #{keyword,jdbcType=VARCHAR},", "comment = #{comment,jdbcType=VARCHAR},", "tx_hash = #{txHash,jdbcType=VARCHAR},", "address = #{address,jdbcType=VARCHAR},", "chain_type = #{chainType,jdbcType=TINYINT},", "type = #{type,jdbcType=TINYINT},", "status = #{status,jdbcType=TINYINT},", "create_time = #{createTime,jdbcType=TIMESTAMP},", "modify_time = #{modifyTime,jdbcType=TIMESTAMP}", "where id = #{id,jdbcType=INTEGER}" })
    int updateByPrimaryKey(TbTransAudit record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    @Insert({ "<script>", "insert into tb_trans_audit (chain_id, ", "chain_name, group_id, ", "app_name, keyword, ", "comment, tx_hash, ", "address, chain_type, ", "type, status, ", "create_time, modify_time)", "values<foreach collection=\"list\" item=\"detail\" index=\"index\" separator=\",\">(#{detail.chainId,jdbcType=INTEGER}, ", "#{detail.chainName,jdbcType=VARCHAR}, #{detail.groupId,jdbcType=INTEGER}, ", "#{detail.appName,jdbcType=VARCHAR}, #{detail.keyword,jdbcType=VARCHAR}, ", "#{detail.comment,jdbcType=VARCHAR}, #{detail.txHash,jdbcType=VARCHAR}, ", "#{detail.address,jdbcType=VARCHAR}, #{detail.chainType,jdbcType=TINYINT}, ", "#{detail.type,jdbcType=TINYINT}, #{detail.status,jdbcType=TINYINT}, ", "#{detail.createTime,jdbcType=TIMESTAMP}, #{detail.modifyTime,jdbcType=TIMESTAMP})</foreach></script>" })
    int batchInsert(List<TbTransAudit> list);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table tb_trans_audit
     *
     * @mbg.generated
     */
    @SelectProvider(type = TbTransAuditSqlProvider.class, method = "getOneByExample")
    @Results({ @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER, id = true), @Result(column = "chain_id", property = "chainId", jdbcType = JdbcType.INTEGER), @Result(column = "chain_name", property = "chainName", jdbcType = JdbcType.VARCHAR), @Result(column = "group_id", property = "groupId", jdbcType = JdbcType.INTEGER), @Result(column = "app_name", property = "appName", jdbcType = JdbcType.VARCHAR), @Result(column = "keyword", property = "keyword", jdbcType = JdbcType.VARCHAR), @Result(column = "comment", property = "comment", jdbcType = JdbcType.VARCHAR), @Result(column = "tx_hash", property = "txHash", jdbcType = JdbcType.VARCHAR), @Result(column = "address", property = "address", jdbcType = JdbcType.VARCHAR), @Result(column = "chain_type", property = "chainType", jdbcType = JdbcType.TINYINT), @Result(column = "type", property = "type", jdbcType = JdbcType.TINYINT), @Result(column = "status", property = "status", jdbcType = JdbcType.TINYINT), @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP), @Result(column = "modify_time", property = "modifyTime", jdbcType = JdbcType.TIMESTAMP) })
    Optional<TbTransAudit> getOneByExample(TbTransAuditExample example);
}
